package org.pearl.dubbodemoproduce.service;

import org.apache.dubbo.common.URL;
import org.apache.dubbo.config.annotation.DubboService;
import org.apache.dubbo.remoting.Constants;
import org.apache.dubbo.rpc.Exporter;
import org.apache.dubbo.rpc.Invoker;
import org.apache.dubbo.rpc.RpcContext;

import org.pearl.produce.api.service.DemoService;
import org.springframework.stereotype.Service;

import java.util.concurrent.CompletableFuture;

import static org.apache.dubbo.rpc.support.ProtocolUtils.serviceKey;


/**
 * Created by TD on 2021/9/6
 */
@DubboService(version = "1.0.0")
@Service
public class DemoServiceImpl implements DemoService {

    @Override
    public String sayName(String name) {
        return name;
    }

    @Override
    public String sayHello(String name) {
        return "Hello " + name + ", response from provider: " + RpcContext.getServiceContext().getLocalAddress();
    }

    @Override
    public CompletableFuture<String> sayHelloAsync(String name) {
        return null;
    }
}